package interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import oracle.net.aso.p;

public class StopWatchHandlerInterceptor extends HandlerInterceptorAdapter {
	
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {

	    if(request.getSession().getAttribute("client")!=null) {  
	        return true;  
	    }else{ 
	    	System.out.println("Interceptor exe!");
	    	System.out.println(request.getContextPath());
	    	response.sendRedirect(request.getContextPath()+"/login.jsp");
//	    	request.getRequestDispatcher("/client/login").forward(request, response);
	    	return false;
	    }
	}
	
}
